<cfcomponent output="false">

<!--- Application settings --->
<cfset this.name = "jndiexample" />
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0,0,30,0)>
<cfset this["mappings"]["/hibernate"] = expandpath("./hibernate") />

<cffunction name="onApplicationStart" output="false">
<cfscript>
	params["hibernate.dialect"] = "org.hibernate.dialect.MySQL5InnoDBDialect";
	params["hibernate.connection.datasource"] = "java:jdbc/projects";
	//      params["hibernate.cache.provider_class"] = "org.hibernate.cache.HashtableCacheProvider";
	//      params["hibernate.default_schema"] = "coldshen";
//  params["hibernate.hbm2ddl.auto"] = "create-drop";
	params["hibernate.show_sql"] = "true";
	params["hibernate.default_entity_mode"] = "dynamic-map";
	application.hibernateService = createObject("component","hibernate.HibernateService").init(params);
</cfscript>
</cffunction>


<cffunction name="onRequest">
    <cfargument name="targetPage" type="string" required="true">
		<cfif structKeyExists(url,"init")><cfset onApplicationStart() /></cfif>
		<cfset request.hibernateService = application.hibernateService />
    <cfinclude template="#arguments.targetPage#">
</cffunction>

</cfcomponent>